package com.jbm.onehome.iface;

import com.jbm.core.iface.IAcross;
import org.hibernate.annotations.*;

import javax.persistence.*;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.math.BigDecimal;
import java.sql.Timestamp;

/**
 * Created by lyh on 2017-04-06.
 */
@Entity
@Table(name = "order_items", schema = "", catalog = "jbmcore")
@org.hibernate.annotations.Entity(dynamicUpdate=true,dynamicInsert=true)
public class OrderItemsEntity extends IAcross
{
    private static final long serialVersionUID = -4198520511670134465L;
    @Transient
    public boolean back;
    @Transient
    public String method;
    @Transient
    public String errorinfo;
    @Transient
    public int count;
    @Transient
    public int start=0;
    @Transient
    public int pagesize=0;
    @Transient
    public Integer tableid;
    private int ordItemId;
    private int orderId;
    private int goodsId;
    private int quantity;
    private BigDecimal price;
    private String itemDesc;
    private String status;
    private Timestamp createDate;
    private Integer createId;
    private Integer gcId;

	public OrderItemsEntity()
	{
		super();
	}

	public OrderItemsEntity(IAcross ia)
	{
		super(ia);
	}

    @Id
    @Column(name = "ord_item_id")
    @GeneratedValue
    public int getOrdItemId() {
        return ordItemId;
    }

    public void setOrdItemId(int ordItemId) {
        this.ordItemId = ordItemId;
    }

    @Basic
    @Column(name = "order_id")
    public int getOrderId() {
        return orderId;
    }

    public void setOrderId(int orderId) {
        this.orderId = orderId;
    }

    @Basic
    @Column(name = "goods_id")
    public int getGoodsId() {
        return goodsId;
    }

    public void setGoodsId(int goodsId) {
        this.goodsId = goodsId;
    }

    @Basic
    @Column(name = "quantity")
    public int getQuantity() {
        return quantity;
    }

    public void setQuantity(int quantity) {
        this.quantity = quantity;
    }

    @Basic
    @Column(name = "price")
    public BigDecimal getPrice() {
        return price;
    }

    public void setPrice(BigDecimal price) {
        this.price = price;
    }

    @Basic
    @Column(name = "item_desc")
    public String getItemDesc() {
        return itemDesc;
    }

    public void setItemDesc(String itemDesc) {
        this.itemDesc = itemDesc;
    }

    @Basic
    @Column(name = "status")
    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    @Basic
    @Column(name = "create_date")
    public Timestamp getCreateDate() {
        return createDate;
    }

    public void setCreateDate(Timestamp createDate) {
        this.createDate = createDate;
    }

    @Basic
    @Column(name = "create_id")
    public Integer getCreateId() {
        return createId;
    }

    public void setCreateId(Integer createId) {
        this.createId = createId;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        OrderItemsEntity that = (OrderItemsEntity) o;

        if (goodsId != that.goodsId) return false;
        if (ordItemId != that.ordItemId) return false;
        if (orderId != that.orderId) return false;
        if (price != that.price) return false;
        if (quantity != that.quantity) return false;
        if (createDate != null ? !createDate.equals(that.createDate) : that.createDate != null) return false;
        if (createId != null ? !createId.equals(that.createId) : that.createId != null) return false;
        if (itemDesc != null ? !itemDesc.equals(that.itemDesc) : that.itemDesc != null) return false;
        if (status != null ? !status.equals(that.status) : that.status != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = ordItemId;
        result = 31 * result + orderId;
        result = 31 * result + goodsId;
        result = 31 * result + quantity;

        result = 31 * result + (itemDesc != null ? itemDesc.hashCode() : 0);
        result = 31 * result + (status != null ? status.hashCode() : 0);
        result = 31 * result + (createDate != null ? createDate.hashCode() : 0);
        result = 31 * result + (createId != null ? createId.hashCode() : 0);
        return result;
    }

    @Basic
    @Column(name = "gc_id")
    public Integer getGcId() {
        return gcId;
    }

    public void setGcId(Integer gcId) {
        this.gcId = gcId;
    }
}
